<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>

  <title></title>
  <script type="text/javascript" src="<?php echo base_url().'public/home/js/' ?>jquery.js"></script>
  <?php
  include_once 'public/views/header.php';
  include_once 'public/home/html/fullCalendar.php';
  include_once 'public/home/html/mobile_select';
  ?>
  <?php include_once "public/home/html/alert.php"  ?>   
  <script type="text/javascript" src="<?php echo base_url().'public/home/js/' ?>function.js"></script>
  <!-- <script src="public/home/js/function.js"></script> -->
  <link rel="stylesheet" href="<?php echo base_url().'public/h_ui/lib/Hui-iconfont/1.0.8/' ?>iconfont.css">
  <link rel="stylesheet" href="<?php echo base_url().'public/home/css/' ?>mui.min.css">

</head>
<style>
  body{
    background-color: white;
    /*height:100%;*/
  }
  #calendar{
    padding:10px!important;
    background-color: white;
    /*height:100%;*/
  }
  .fc-scroller{
    height: auto!important;
  }
  iframe{
    height: 600px;
    width: 300px;
  }
  .profile-user-info{
    margin: 0!important
  }
  .fc-center h2{
    font-size: 16px!important;
  }
</style>
<body>
    <div class="search-head header mui-bar mui-bar-nav row" style="background-color: #f7f9fa; border:none;margin-top:0px !important">
        <div class="col-xs-1" style="margin-top: 3%">
            <a class=" Hui-iconfont Hui-iconfont-slider-left" href="javascript:void(0)" onclick="history.back();" style="color: #C9C9C9"></a>
        </div>
        <div class="col-xs-11">
            <h1 class="mui-title" style="color:#333;margin-left: -5%">当天课程</h1>
        </div>
    </div>
  <input type="hidden" id='url' value="<?php echo base_url();?>" />
  <div class="page-container container" style="margin-top: 13%;width: 100%;font-size: 16px">
    <div class="col-xs-12 calendar-col col-item">
      <div id="calendar"></div>
    </div>

    <div style="display: none;" id="content"> 
      <div class="space visible-xs" ></div>
      <div class="profile-user-info profile-user-info-striped">
        <div class="profile-info-row">
          <div class="profile-info-name"> 课程名称 </div>
          <input type="hidden"  id="class_id" />
          <div class="profile-info-value">
            <i class="icon-book light-orange bigger-110" style="font-size: 19px; margin-right: 10px;"></i>
            <span class="park_principal" id="class_name"></span>
          </div>
        </div>
        <div class="profile-info-row">
          <div class="profile-info-name"> 课程时间 </div>
          <div class="profile-info-value">
            <i class="icon-time light-orange bigger-110" style="font-size: 19px; margin-right: 10px;"></i>
            <span class="park_contact_phone" id="class_time"></span>
          </div>
        </div>
        <div class="profile-info-row">
          <div class="profile-info-name"> 授课教师 </div>
          <input type="hidden" id='teacher_id' value="" />
          <div class="profile-info-value">
            <i class="icon-user light-orange bigger-110" style="font-size: 19px; margin-right: 10px;"></i>
            <span class="park_address" id="class_username"></span>
          </div>
        </div>
        <div class="profile-info-row">
          <div class="profile-info-name"> 开课单位 </div>
          <div class="profile-info-value">
            <i class="icon-group light-orange bigger-110" style="font-size: 19px; margin-right: 10px;"></i>
            <span class="park_operating_company" id="class_course_units"></span>
          </div>
        </div>
        <div class="profile-info-row">
          <div class="profile-info-name"> 课程教室 </div>
          <div class="profile-info-value">
            <i class="icon-building light-orange bigger-110" style="font-size: 19px; margin-right: 10px;"></i>
            <span class="park_operating_company" id="class_classroom"></span>
          </div>
        </div>
      </div>


    </body>
    <script>

      $(function(){
        getClass();
      })

      function getClass(){
        $('#calendar').fullCalendar({
          header:false,
      aspectRatio:2,
      defaultView: "listDay",
      firstHour:6,  
      // defaultDate: '2019-01-12',
      navLinks: true, // can click day/week names to navigate views
      editable: false,
      eventLimit: true, // allow "more" link when too many events
      eventClick:function(event, jsEvent, view){//当点击日历中的某一日程（事件）时，触发此操作
        // event.title = "CLICKED!";
        // $('#calendar').fullCalendar('updateEvent', event);
        showClass(event.id);
      },
      dayClick: function(date, allDay, jsEvent, view) { //当单击日历中的某一天时，触发callback
        /*var views = $('#calendar').fullCalendar('getView'); */
        // showAddWorkArrangementAddView(jsDataToPhpDate(date));
      },
      events: function(start, end, timezone, callback) {
        $.ajax({
          type: "post",
          url: "Home/Class_Assess/getClass",
          data:{},
          dataType:'json',
           // async: true,
           success: function(data) {
            if(data.status) {
              var t=JSON.parse(data.v);
              // work_arrangement=t;
              callback(t);
            } else {
              window.parent.topMessagePrompt('error',data.msg);
            }
          }
        });
      }
    });
      }

      function updateClass(){
        $('#calendar').fullCalendar( 'refetchEvents' );
      }


      function showClass(id){
  // showDialogModal(getRootPath()+'/Admin/Classes/showClass/'+id,400,450);
  // window.location.href=getRootPath()+"/Home/Class_Assess/Index/0";
  $.ajax({
    url: $("#url").val()+'Home/Class_Assess/showClass/'+id,
    type: 'POST',
    dataType: 'json',
    async:false,
    data: {},
    success:function(data){
      if(data.status){
        var t=JSON.parse(data.v);
        $("#content").show();
        $("#class_classroom").html(t['classroom']);
        $("#class_course_units").html(t['course_units']);
        $("#class_username").html(t['username']);
        $("#class_time").html(t['start_time']+"至"+t['end_time']);
        $("#class_name").html(t['name']);
        $("#teacher_id").val(t['teacher_id']);
        $("#class_id").val(t['id']);
      }
    }
  })
  dialog1 = jqueryAlert({
   'style': 'wap',
   'title': '课程详情',
   'content': $("#content"),
   'modal': true,
   'contentTextAlign': 'left',
   'width': '300',
   'height': '500',
   'animateType': 'linear',
   'buttons': {
     '关闭': function() {
       dialog1.close();
       $("#content").hide();
     },
     '听课':function(){
      dialog1.close();
      window.location.href=getRootPath()+"/Home/Class_Assess/Index/0"+"/"+$("#teacher_id").val()+"/"+$("#class_id").val();
    }
  }
})


}






</script>

</html>